{include file="common/head"/}
<div class="layui-fluid"><div class="layui-card"><div class="layui-card-body">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>修改分类</legend>
    </fieldset>
    <!-- <blockquote class="layui-elem-quote">
    </blockquote> -->
    <form class="layui-form layui-form-pane">
        <div class="layui-form-item">
            <label class="layui-form-label">上级分类</label>
            <div class="layui-input-inline" style="width: 350px;">
                <select name="pid" lay-verify="required" lay-filter="pid" >
                    <option value="0" >默认顶级</option>
                    {volist name="parent" id="vo"}
                        <option value="{$vo.id}" {eq name="$cate['pid']" value="$vo.id"}selected{/eq} {eq name="$cate['id']" value="$vo.id"}disabled{/eq} >{$vo.lefthtml}{$vo.title}</option>
                    {/volist}
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-inline" style="width: 350px;">
                <input type="text" name="title" value="{$cate['title']}" lay-verify="required" placeholder="{:lang('pleaseEnter')}名称" class="layui-input">
            </div>
        </div>
        
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">排序</label>
                <div class="layui-input-inline">
                <input type="text" name="sort" value="50" placeholder="{:lang('pleaseEnter')}排序编号" class="layui-input">
            </div>
        </div> -->
        <input type="hidden" name="id" value="{$cate['id']}">
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit">立即提交</button>
                <a href="{:url('index')}" class="layui-btn layui-btn-primary">返回</a>
            </div>
        </div>
    </form>
</div>
</div>
</div>
{include file="common/foot"/}
<script>
    layui.use(['form', 'layer'], function () {
        var form = layui.form, layer = layui.layer, $=layui.jquery;
        form.on('submit(submit)', function (data) {
            // 提交到方法 默认为本身
            $.post("{:url('edit')}",data.field,function(res){
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        location.href = res.url;
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2});
                }
            });
        })

    });
</script>